package com.sleepingcat.ft_flutter.channel

import io.flutter.embedding.engine.FlutterEngine
import io.flutter.embedding.engine.plugins.FlutterPlugin

object ChannelManager {
    lateinit var commonChannel: CommonChannel
    lateinit var dialogChannel: DialogChannel
    lateinit var userChannel: UserChannel
    lateinit var boostChannel: BoostChannel

    fun plugins(engine: FlutterEngine): Set<FlutterPlugin> {
        if (!this::commonChannel.isInitialized) {
            commonChannel = CommonChannel(engine)
        }
        if (!this::dialogChannel.isInitialized) {
            dialogChannel = DialogChannel(engine)
        }
        if (!this::userChannel.isInitialized) {
            userChannel = UserChannel(engine)
        }
        if (!this::boostChannel.isInitialized) {
            boostChannel = BoostChannel(engine)
        }
        return setOf(commonChannel, dialogChannel, userChannel, boostChannel)
    }
}